Change in openvpn[master]: Implement HKDF expand function based on RFC 8446
A message that is not in the archive (sent off-list or not yet received): gerrit.1731290343000.I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to review the following change.
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 304 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/1
CMakeLists.txt +3 -0
@@ -389,6 +389,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -717,6 +719,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +106 -0
107 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +69 -0
69 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +123 -2
143 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to look at the new patch set (#4).
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 303 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/4
CMakeLists.txt +3 -0
@@ -389,6 +389,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -717,6 +719,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +106 -0
106 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +69 -0
69 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +122 -1
141 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 4: Code-Review-2
(5 comments)
Patchset:
PS4:
The implementation of HKDF-Expand is correct, but the implementation of HKDF-Expand-Label is slightly wrong in a way that causes different (label, context) pairs to produce identical keys (in a predictable way).
Another thing: Are there any plans to actually use the context argument?
File src/openvpn/crypto_epoch.h:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/152f282d_bc633665 :
PS4, Line 32: * - salt is always assumed to be zero length (ie not supported)
: * - IKM (secret) is assumed to be always 32 bytessalt and IKM are arguments for HKDF-Extract, not HKDF-Expand.
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/006aedfa_6f857acd :
PS4, Line 67: hmac_ctx_cleanup(hmac_ctx);
: hmac_ctx_free(hmac_ctx);Not exactly about this commit itself, but looking at these functions, it's not clear to me why we need both. The doc comments for both say "free the HMAC context".
http://gerrit.openvpn.net/c/openvpn/+/798/comment/ea9a9a5f_e4e2916c :
PS4, Line 83: }
We could check label_len and context_len too:
* label_len <= 250 (because the total length including prefix must be <= 255)
* context_len <= 255
http://gerrit.openvpn.net/c/openvpn/+/798/comment/b32d3125_e4ee1228 :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "ovpn " */
: int hkdf_label_len = 2 + 5 + label_len + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }That's not exactly how this works. When an RFC specifies a variable-length array, it has to be prefixed with a fixed-size length field. In this case, the maximum length for label and context is 255 each, so the length fields are 1 byte. See RFC 1832.
That means hkdf_label_len = 2 + 1 + 5 + label_len + 1 + context_len.
The label needs to be prefixed with label_len + 5 (the prefix is counted), the context is prefixed with context_len.
Otherwise, the inputs would be ambiguous: label = "abcdef", context = "" and label = "abc", context = "def" would give the same result.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 20 Nov 2024 16:48:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 4:
(1 comment)
Patchset:
PS4:
Quoted 1 line
The implementation of HKDF-Expand is correct, but the implementation of HKDF-Expand-Label is slightl […]
By "predictable" I mean non-random. Of course there are always (label, context) pairs that randomly produce the same output. But with this implementation, it's easy to find such pairs.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 20 Nov 2024 16:53:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: MaxF, flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 4:
(5 comments)
Patchset:
PS4:
Thanks for the review.
File src/openvpn/crypto_epoch.h:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/d8777d7c_f373c906 :
PS4, Line 32: * - salt is always assumed to be zero length (ie not supported)
: * - IKM (secret) is assumed to be always 32 bytesQuoted 1 line
salt and IKM are arguments for HKDF-Extract, not HKDF-Expand.
You are right. I will remove those as they are not even parameters and we don't use HDKF-Extract at all.
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/496fe9e5_57694e82 :
PS4, Line 67: hmac_ctx_cleanup(hmac_ctx);
: hmac_ctx_free(hmac_ctx);Quoted 1 line
Not exactly about this commit itself, but looking at these functions, it's not clear to me why we ne […]
mbed TLS needs both:
voidmd_ctx_cleanup(mbedtls_md_context_t *ctx)
{
mbedtls_md_free(ctx);
}voidhmac_ctx_free(mbedtls_md_context_t *ctx)
{
free(ctx);
}They do different things and you need both otherwise you leave memory behind.
http://gerrit.openvpn.net/c/openvpn/+/798/comment/38a2fb96_8e7628d3 :
PS4, Line 83: }
Quoted 1 line
We could check
label_lenandcontext_lentoo: […]
Acknowledged
http://gerrit.openvpn.net/c/openvpn/+/798/comment/5ded05ce_c4d2d7a5 :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "ovpn " */
: int hkdf_label_len = 2 + 5 + label_len + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Quoted 1 line
That's not exactly how this works. […]
Hm, I know what you are saying, at the same time, TLS 1.3 also doesn't add that extra byte for the context length:
https://datatracker.ietf.org/doc/html/rfc8446#section-7.1
I think the label and context is rather theorectical since we a) always have the same label and b) don't use context at all.
So I can just remove the possibility to use context from this function if that function if that makes things better. This was intended to do the same as TLS 1.3 just with "ovpn " instead of "tls13 "
I think what TLS RFC fails to mention and I also fail to mention is that you this label construction is a bit brittle in the sense that you have described, ie. you need to ensure that all the labels you are using this function with are not prefixes of each other.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 20 Nov 2024 19:56:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/66b3a85e_5d30ac1a :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "ovpn " */
: int hkdf_label_len = 2 + 5 + label_len + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Quoted 1 line
Hm, I know what you are saying, at the same time, TLS 1. […]
TLS 1.3 does use length fields here, it's implied by the "opaque label<7..255>" notation.
You can look at the implementations in OpenSSL or mbed TLS. For example, see ssl_tls13_hkdf_encode_label() in https://github.com/Mbed-TLS/mbedtls/blob/development/library/ssl_tls13_keys.c
Removing the context argument and otherwise leaving the function as-is is fine.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 20 Nov 2024 21:28:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: MaxF, flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/a9e383fb_853c2f64 :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "ovpn " */
: int hkdf_label_len = 2 + 5 + label_len + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Quoted 1 line
TLS 1.3 does use length fields here, it's implied by the "opaque label<7..255>" notation. […]
Yeah, you are right. I think I still want to modify it to be the same as in the TLS standard as that is propabably better in the long run, especially for DCO implementation as they then may reuse something written for TLS in kernel etc.
I just now have to figure out why OpenSSL ends up having 0x00 0x54 between opvn and unit test in the expanded label and if that is on purpose or if I messed up using the OpenSSL API.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Thu, 21 Nov 2024 13:07:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: MaxF, flichtenheld.
Hello MaxF, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to look at the new patch set (#5).
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 433 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/5
CMakeLists.txt +3 -0
@@ -389,6 +389,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -717,6 +719,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +113 -0
113 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -2
270 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 5: -Code-Review
(5 comments)
Patchset:
PS5:
The ovpn_expand_label() function looks good to me now. I have some nitpicks but it should work correctly. Also, I really like that you added a test to see that it produces the same result as OpenSSL!
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/4f1de082_54f44df5 :
PS4, Line 67: hmac_ctx_cleanup(hmac_ctx);
: hmac_ctx_free(hmac_ctx);Quoted 1 line
mbed TLS needs both: […]
Makes sense!
http://gerrit.openvpn.net/c/openvpn/+/798/comment/a592ddf7_ad5c9cd2 :
PS4, Line 86: /* 2 byte for the outlen encoded as uint16, 5 bytes for "ovpn " */
: int hkdf_label_len = 2 + 5 + label_len + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
:
: buf_write_u16(&hkdf_label, out_len);
: buf_write(&hkdf_label, "ovpn ", 5);
: buf_write(&hkdf_label, label, label_len);
: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Quoted 1 line
Yeah, you are right. […]
I agree, it's a good idea to keep it close to the TLS standard. Also makes it easier if someone else is going to review it in the future.
The current implementation looks good to me!
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/2574664f_9fe72c38 :
PS5, Line 89: int hkdf_label_len = 2 + 5 + 1 + label_len + 1 + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
: const uint8_t *label_prefix = (const uint8_t *) ("ovpn ");
: int prefix_len = 5;You could move the prefix_len declaration up and replace the "5" in hkdf_label_len with it.
http://gerrit.openvpn.net/c/openvpn/+/798/comment/effb4ac6_eb381832 :
PS5, Line 101: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Why do we need this check? buf_write() doesn't do anything if context_len is 0 right?
(And if it's needed, why is it not needed for label?)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 23 Nov 2024 00:00:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello MaxF, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to look at the new patch set (#6).
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 434 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/6
CMakeLists.txt +3 -0
@@ -389,6 +389,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -717,6 +719,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -2
270 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: MaxF, flichtenheld.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 6:
(3 comments)
File src/openvpn/crypto_epoch.h:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/4094583d_be1b5fbb :
PS4, Line 32: * - salt is always assumed to be zero length (ie not supported)
: * - IKM (secret) is assumed to be always 32 bytesQuoted 1 line
You are right. […]
Done
File src/openvpn/crypto_epoch.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/3d0b791f_15e4f6e5 :
PS5, Line 89: int hkdf_label_len = 2 + 5 + 1 + label_len + 1 + context_len;
: struct buffer hkdf_label = alloc_buf_gc(hkdf_label_len, &gc);
:
: const uint8_t *label_prefix = (const uint8_t *) ("ovpn ");
: int prefix_len = 5;Quoted 1 line
You could move the
prefix_lendeclaration up and replace the "5" inhkdf_label_lenwith it.
Done
http://gerrit.openvpn.net/c/openvpn/+/798/comment/0f194e22_472a8009 :
PS5, Line 101: if (context_len > 0)
: {
: buf_write(&hkdf_label, context, context_len);
: }Quoted 1 line
Why do we need this check?
buf_write()doesn't do anything ifcontext_lenis 0 right? […]
label is supposed to always at least 1 character. I added a check for that.
buf_write will still call memcpy with a 0 and at least according to C standard the pointer must still be valid so I wanted to be safe.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Sat, 23 Nov 2024 21:04:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 6: Code-Review+2
(2 comments)
Patchset:
PS4:
Quoted 1 line
By "predictable" I mean non-random. […]
Fixed
Patchset:
PS6:
Looks good to me!
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 24 Nov 2024 12:47:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: MaxF <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 6: Code-Review-1
(1 comment)
Patchset:
PS6:
Note that this needs an uncrustify fix
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Thu, 28 Nov 2024 10:10:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: MaxF, flichtenheld, plaisthos.
Hello MaxF, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to look at the new patch set (#7).
The following approvals got outdated and were removed:
Code-Review+2 by MaxF, Code-Review-1 by flichtenheld
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 433 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/7
CMakeLists.txt +3 -0
@@ -387,6 +387,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -715,6 +717,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +243 -1
268 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 7
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: MaxF, flichtenheld, plaisthos.
Hello MaxF, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
to look at the new patch set (#8).
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 434 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/8
CMakeLists.txt +3 -0
@@ -387,6 +387,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -715,6 +717,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -1
269 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 8:
(1 comment)
File tests/unit_tests/openvpn/test_crypto.c:
http://gerrit.openvpn.net/c/openvpn/+/798/comment/a60b60d0_ab588901 :
PS8, Line 469: exception
Do you mean expectation?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 8
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 02 Dec 2024 10:31:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Patch Set 9: Code-Review+2
(1 comment)
Patchset:
PS9:
I'll take the +2 from MaxF on v7, uncrustify got fixed in v8, and the "expectation" comment will be fixed on the fly.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 9
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sat, 21 Dec 2024 22:23:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v9 1/1 Implement HKDF expand function based on RFC 8446
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/798
This mail reflects revision 9 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
CMakeLists.txt +3 -0
@@ -387,6 +387,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -715,6 +717,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -1
269 lines not on this page · raw message
[Openvpn-devel] [PATCH applied] Re: Implement HKDF expand function based on RFC 8446
There is not much for me to test here - this is new code which is not yet used anywhere. But it does not break anything :-) - and the crypto part has a +2 by MaxF in gerrit, which is most important. Plus, it brings a unit tests (using OpenSSL 3.0 to verify identical behaviour).
Since this introduces two new files, doing GHA builds with cmake and autoconf also confirms that both build systems have been correctly adjusted (and inclusion in openvpn_SOURCES will take care of "make dist").
Your patch has been applied to the master branch.
commit 5d3d2e42c332443e57eeff7d81c89ae8916815d9
Author: Arne Schwabe Date: Sat Dec 21 23:24:04 2024 +0100
Implement HKDF expand function based on RFC 8446
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: MaxF <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30149.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#10) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30149.html
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 434 insertions(+), 1 deletion(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/798/10
CMakeLists.txt +3 -0
@@ -387,6 +387,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -715,6 +717,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -1
269 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/798?usp=email )
Change subject: Implement HKDF expand function based on RFC 8446
......................................................................
Implement HKDF expand function based on RFC 8446
Use crypto_epoch.c/h for the new functions since they are linked to the epoch key usage in OpenVPN.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30149.html
---
M CMakeLists.txt
M src/openvpn/Makefile.am
A src/openvpn/crypto_epoch.c
A src/openvpn/crypto_epoch.h
M src/openvpn/crypto_mbedtls.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_crypto.c
7 files changed, 434 insertions(+), 1 deletion(-)
CMakeLists.txt +3 -0
@@ -387,6 +387,8 @@ src/openvpn/crypto.c src/openvpn/crypto.h src/openvpn/crypto_backend.h + src/openvpn/crypto_epoch.c + src/openvpn/crypto_epoch.h src/openvpn/crypto_openssl.c src/openvpn/crypto_openssl.h src/openvpn/crypto_mbedtls.c
@@ -715,6 +717,7 @@ target_sources(test_crypto PRIVATE src/openvpn/crypto_mbedtls.c src/openvpn/crypto_openssl.c + src/openvpn/crypto_epoch.c src/openvpn/crypto.c src/openvpn/otime.c src/openvpn/packet_id.c
src/openvpn/Makefile.am +1 -0
@@ -53,6 +53,7 @@ crypto.c crypto.h crypto_backend.h \ crypto_openssl.c crypto_openssl.h \ crypto_mbedtls.c crypto_mbedtls.h \ + crypto_epoch.c crypto_epoch.h \ dco.c dco.h dco_internal.h \ dco_freebsd.c dco_freebsd.h \ dco_linux.c dco_linux.h \
src/openvpn/crypto_epoch.c new file +114 -0
114 lines not on this page · raw message
src/openvpn/crypto_epoch.h new file +70 -0
70 lines not on this page · raw message
src/openvpn/crypto_mbedtls.h +1 -0
@@ -29,6 +29,7 @@#ifndef CRYPTO_MBEDTLS_H_ #define CRYPTO_MBEDTLS_H_ +#include <stdbool.h> #include <mbedtls/cipher.h> #include <mbedtls/md.h> #include <mbedtls/ctr_drbg.h>
tests/unit_tests/openvpn/Makefile.am +1 -0
@@ -66,6 +66,7 @@ $(top_srcdir)/src/openvpn/crypto.c \ $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_epoch.c \ $(top_srcdir)/src/openvpn/otime.c \ $(top_srcdir)/src/openvpn/packet_id.c \ $(top_srcdir)/src/openvpn/platform.c \
tests/unit_tests/openvpn/test_crypto.c +244 -1
269 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/798?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3a1c6561f4d9a69e2a441d49dff620b4258a1bcc
Gerrit-Change-Number: 798
Gerrit-PatchSet: 10
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged